<template>
<div>
 <div style="width: 1220px;height: 200px">
   <div ><Navigation_bar @id="get_pid"></Navigation_bar>
     <img src="http://172.20.10.4:5000/static/duxiaomanbanner.png" alt="" style="width: 1220px;height: 200px">
  </div>
   <div style="width: 80px;float: left;height: 500px">
     <left @id="get_quanx"></left>

   </div>
   <div style="float: left">
    <div v-if="pid==0">
      <accout></accout>
    </div> <div v-if="pid==80">
      首页
    </div>
     <div v-if="pid==76">
      登录接口
    </div><div v-if="pid==2">
     <addmark></addmark>
    </div><div v-if="pid==1">
     <investment></investment>
    </div><div v-if="pid==3">
     <bank_fund></bank_fund>
    </div>
   </div>
 </div>
</div>
<van-popup v-model:show="show_hours"  closeable close-icon="close" :style="{ height: '100%' ,width: '30%' }">


    <table>
      <tr v-for="(i) in dict" :key="i">
        <td>
         {{i.topic}}
          <p>
            <el-radio-group v-model="radio[i.id]" v-for="(j,value) in i.answer" :key="j" @change="add_num()">
              <el-radio :label="j.split(' ')[1]"   >{{value.split(" ")[0]}}{{ j.split(" ")[0] }}</el-radio>
            </el-radio-group>
          </p>
        </td>
      </tr>
    </table>
    <van-button @click="git_num">提交</van-button>
</van-popup>
</template>

<script>
import Navigation_bar from "@/components/Navigation_bar";
import left from "@/components/left";
import accout from "@/components/accout";
import addmark from "@/components/addmark";
import investment from "@/components/investment";
import bank_fund from "@/components/bank_fund";




export default {
name: "financial_homepage",
  data(){
  return{
  id:localStorage.getItem('usrid'),
    list:[],
    nume:1,
    pid:80,
    show_hours:false,
    dict:[],
    radio:{},
    num:0,
    nums:0,
    num_pass:null,
    num_list:[],
    uid:localStorage.getItem('usrid'),
    investment:''
  }
  },
  components:{
    Navigation_bar:Navigation_bar,
    left:left,
    accout:accout,
    addmark:addmark,
    investment:investment,
    bank_fund:bank_fund,


  },
  methods:{
  // 提交题目
    git_num(){
      this.axios.post('http://localhost:5000/assess_grade',{'data':this.radio,'uid':this.uid}).then(res=>{
        console.log(res);
        if (res.data.code=='200'){
          this.show_hours=false
          localStorage.setItem('login_hours',1)
        }
      })
    },
    add_num(){
      console.log(this.radio)
      console.log(this.num_pass)

    },

    get_quanx(id){
      this.pid=id
      console.log(this.pid)
    },
    get_pid(id){
      this.pid=id
      console.log(this.pid)
    },

  get_role(){
    this.myaxios('http://localhost:5000/user_permissions','get',{'id':this.id})
    .then(res=>{
      console.log(res)
      this.list=res.res
    })
  },
    get_hours(){
      this.myaxios('http://localhost:5000/reciews','get',{})
          .then(res=>{
            console.log(res)
            this.dict=res.data
          })
    }
  },
  mounted() {
  this.get_role()
  if (localStorage.getItem('login_hours')==0){
    this.show_hours=true
    this.get_hours()
  }
  }
}
</script>

<style scoped>

</style>
